/******************************************************************************
 * Copyright (C) 2015  671643387@qq.com
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *****************************************************************************/

#ifndef GAME_GAME_PLAYER_H_
#define GAME_GAME_PLAYER_H_

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif

#include "Shared/Global_Macros.h"
#include "Shared/DB/QueryResult.h"
#include "Shared/Binary/WorldPacket.h"
#include "Game/PlayerDefines.h"

///////////////////////////////////////////////////////////////////////////////
enum ActionButtonUpdateState
{
    ACTIONBUTTON_UNCHANGED      = 0,
    ACTIONBUTTON_CHANGED        = 1,
    ACTIONBUTTON_NEW            = 2,
    ACTIONBUTTON_DELETED        = 3
};

enum ActionButtonType
{
    ACTION_BUTTON_SPELL         = 0x00,
    ACTION_BUTTON_C             = 0x01,                     // click?
    ACTION_BUTTON_MACRO         = 0x40,
    ACTION_BUTTON_CMACRO        = ACTION_BUTTON_C | ACTION_BUTTON_MACRO,
    ACTION_BUTTON_ITEM          = 0x80
};

#define ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
#define ACTION_BUTTON_TYPE(X)   ((uint32(X) & 0xFF000000) >> 24)
#define MAX_ACTION_BUTTON_ACTION_VALUE (0x00FFFFFF+1)

#define  MAX_ACTION_BUTTONS 120   // TBC 132 checked in 2.3.0

///////////////////////////////////////////////////////////////////////////////
class Player
{
public:

    ///////////////////////////////////////////////////////////////////////////
    static bool buildCharaEnumData(Shared::DB::QueryResult* rs, Shared::Binary::WorldPacket &packet);
    ///////////////////////////////////////////////////////////////////////////
    static bool isActionButtonDataValid(std::uint8_t button, std::uint32_t action, std::uint8_t type, Player* player);

private:
    DISALLOW_COPY_AND_ASSIGN(Player);
};

#endif // GAME_GAME_PLAYER_H_
